<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" /> 
        <link href="assets/css/bootstrap.min.css" rel="stylesheet" />
        <link rel="stylesheet" href="css/style.css"/>       
        <link rel="stylesheet" href="assets/css/ace.min.css" />
        <link rel="stylesheet" href="assets/css/font-awesome.min.css" />
	    <script src="js/jquery-2.1.4.min.js"></script>   
      
<title>产品列表</title>
</head>
<body>
<div class=" page-content clearfix">
 <div id="products_style">
   
     <div class="border clearfix">
       <span class="l_f">
        <a href="picture-add.html" title="添加车辆" class="btn btn-warning Order_form"><i class="icon-plus"></i>添加车辆</a>
        <a href="javascript:ovid()" class="btn btn-danger">刷新</a>
       </span>
       <span class="r_f"></span>
     </div>
     <!--产品列表展示-->
     
         
       <table class="table table-striped table-bordered table-hover" id="table3">
		<thead>
		 <tr>
				
				<th width="80px">手机号码</th>
				<th width="80px">密码</th>
				<th width="150px">车牌号码</th>
				<th width="200px">设备</th>
				<th width="100">设置</th>
			</tr>
		</thead>
		<tbody >
                  
		</tbody>

    </table>
    </div>     
  </div>
 </div>
</div>
</body>
<script>

	function AddTableRow(userid,name,pwd,carno,devicenum)  
	{  
	   
	
			tr = '<tr >'; 
			tr += '<td>' + name+ '</td>';
			tr += '<td>' + pwd+ '</td>';
			tr += '<td>' + carno+ '</td>';
			tr += '<td>' + devicenum+ '</td>';
			tr += '<td><u style=\"cursor:pointer\" onclick=\"deteleData(\''+userid+'\')\"> ' + "删 除"+ '</u></td>';
			tr += '</tr>'
			$("#table3").find("tbody").append(tr);
		

		 
		 
		//  var dd = 1;

  }
  
  initpage();
  function initpage()
  {
//   var posturl = "http://127.0.0.1:8888/myapp/carinterface/indexList.php";
var posturl = "http://118.25.109.93/myapp/carinterface/indexList.php";
	$.post(posturl, {}, function (data) {
	
		// var data=$.parseJSON(data1);
	
		var array = data["data"];
		$("#table3").find("tbody").html("");
	   for(var i=0;i<array.length;i++){ 
		var userId =array[i].id;
		var pwd = array[i].pwd;
		var phone = array[i].phone;
		var carno = array[i].carnum;
		var devicenum = array[i].devicenum;

		AddTableRow(userId,phone,pwd,carno,devicenum);
	   }	
	}, 'json');
  }

	function  deteleData(deteleid)
	{
		// var posturl = "http://127.0.0.1:8888/myapp/carinterface/detelInfo.php?userid="+deteleid;
		var posturl = "http://118.25.109.93/myapp/carinterface/detelInfo.php?userid="+deteleid;
	$.post(posturl, {}, function (data) {
	
		// var data=$.parseJSON(data1);
	
		// var array = data["data"];

	   initpage();

	}, 'json');
	}

	


</script>
</html>